#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	int i,j;
	int a[n];
	int left=0,right=0,max=0,head=0,tail=0;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++){
		left=right=i;
		for(j=i;j<n-1;j++){
			if(a[j+1]>a[j]) right++;
			else break;
		}
		if(right-left>max){
			head=left;
			tail=right;
			max=right-left;
		}
	}
	for(i=head;i<=tail;i++){
		if(i!=head) printf(" %d",a[i]);
		else printf("%d",a[i]);
	}
	return 0;
}
